import request from '@/utils/request'

export function sendCode(data) {
  return request({
    url: '/verification-codes/login',
    method: 'post',
    data
  })
}
export function sendRegCode(data) {
  return request({
    url: '/verification-codes/register',
    method: 'post',
    data
  })
}

// 用户信息
// export function getMyInfo() {
//   return request({
//     url: '/users/my-info',
//     method: 'get'
//   })
// }
export function getMyInfo() {
  return request({
    url: '/user/info?include=roles',
    method: 'get'
  })
}

export function userReg(data) {
  return request({
    url: '/users/register',
    method: 'post',
    data
  })
}

// 登录
// export function userLogin(data) {
//   return request({
//     url: '/users/password-login',
//     method: 'post',
//     data
//   })
// }

export function userLogin(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function userPhoneLogin(data) {
  return request({
    url: '/users/phone-login',
    method: 'post',
    data
  })
}

export function smsCode(data) {
  return request({
    url: '/verification-codes/login',
    method: 'post',
    data
  })
}

// 验证码
export function getImageCode() {
  return request({
    url: '/captcha',
    method: 'get'
  })
}

// 侧边栏
export function getSidebars() {
  return request({
    url: '/user/sidebars',
    method: 'get'
  })
}
